<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Socket::Option - socket: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-bool">::bool</a>
    <li ><a href="#method-c-byte">::byte</a>
    <li ><a href="#method-c-int">::int</a>
    <li ><a href="#method-c-ipv4_multicast_loop">::ipv4_multicast_loop</a>
    <li ><a href="#method-c-ipv4_multicast_ttl">::ipv4_multicast_ttl</a>
    <li ><a href="#method-c-linger">::linger</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-bool">#bool</a>
    <li ><a href="#method-i-byte">#byte</a>
    <li ><a href="#method-i-data">#data</a>
    <li ><a href="#method-i-family">#family</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-int">#int</a>
    <li ><a href="#method-i-ipv4_multicast_loop">#ipv4_multicast_loop</a>
    <li ><a href="#method-i-ipv4_multicast_ttl">#ipv4_multicast_ttl</a>
    <li ><a href="#method-i-level">#level</a>
    <li ><a href="#method-i-linger">#linger</a>
    <li ><a href="#method-i-optname">#optname</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-unpack">#unpack</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Socket::Option">
    <h1 id="class-Socket::Option" class="class">
      class Socket::Option
    </h1>

    <section class="description">
    
<p><a href="Option.html"><code>Socket::Option</code></a> represents a socket option used by <a href="../BasicSocket.html#method-i-getsockopt"><code>BasicSocket#getsockopt</code></a> and <a href="../BasicSocket.html#method-i-setsockopt"><code>BasicSocket#setsockopt</code></a>.  A socket option contains the socket <a href="Option.html#method-i-family"><code>family</code></a>, protocol <a href="Option.html#method-i-level"><code>level</code></a>, option name <a href="Option.html#method-i-optname"><code>optname</code></a> and option value <a href="Option.html#method-i-data"><code>data</code></a>.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-bool" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.bool(family, level, optname, bool) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object which contains boolean as data. Actually 0 or 1 as int is used.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;socket&#39;</span>

<span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">bool</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-keyword">true</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET SOCKET KEEPALIVE 1&gt;</span>

<span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">bool</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-keyword">false</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: AF_INET SOCKET KEEPALIVE 0&gt;</span>
</pre>

                              <div class="method-source-code" id="bool-source">
            <pre>static VALUE
sockopt_s_bool(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vbool)
{
    int family = rsock_family_arg(vfamily);
    int level = rsock_level_arg(family, vlevel);
    int optname = rsock_optname_arg(family, level, voptname);
    int i = RTEST(vbool) ? 1 : 0;
    return rsock_sockopt_new(family, level, optname, pack_var(i));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-byte" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.byte(family, level, optname, integer) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object which contains a byte as data.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">byte</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-value">1</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET SOCKET KEEPALIVE 1&gt;</span>
</pre>

                              <div class="method-source-code" id="byte-source">
            <pre>static VALUE
sockopt_s_byte(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint)
{
    int family = rsock_family_arg(vfamily);
    int level = rsock_level_arg(family, vlevel);
    int optname = rsock_optname_arg(family, level, voptname);
    return rsock_sockopt_new(family, level, optname, sockopt_pack_byte(vint));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-int" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.int(family, level, optname, integer) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object which contains an int as data.</p>

<p>The size and endian is dependent on the platform.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">int</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-value">1</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET SOCKET KEEPALIVE 1&gt;</span>
</pre>

                              <div class="method-source-code" id="int-source">
            <pre>static VALUE
sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint)
{
    int family = rsock_family_arg(vfamily);
    int level = rsock_level_arg(family, vlevel);
    int optname = rsock_optname_arg(family, level, voptname);
    return rsock_sockopt_new(family, level, optname, sockopt_pack_int(vint));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ipv4_multicast_loop" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.ipv4_multicast_loop(integer) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object for IP_MULTICAST_LOOP.</p>

<p>The size is dependent on the platform.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">int</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:IPPROTO_IP</span>, <span class="ruby-value">:IP_MULTICAST_LOOP</span>, <span class="ruby-value">1</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">int</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">1</span>

<span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">ipv4_multicast_loop</span>(<span class="ruby-value">10</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET IP MULTICAST_LOOP 10&gt;</span>
</pre>

                              <div class="method-source-code" id="ipv4_multicast_loop-source">
            <pre>static VALUE
sockopt_s_ipv4_multicast_loop(VALUE klass, VALUE value)
{

#if defined(IPPROTO_IP) &amp;&amp; defined(IP_MULTICAST_LOOP)
    VALUE o = XCAT(sockopt_pack_,TYPE_IP_MULTICAST_LOOP)(value);
    return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_LOOP, o);
#else
# error IPPROTO_IP or IP_MULTICAST_LOOP is not implemented
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ipv4_multicast_ttl" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.ipv4_multicast_ttl(integer) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object for IP_MULTICAST_TTL.</p>

<p>The size is dependent on the platform.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">ipv4_multicast_ttl</span>(<span class="ruby-value">10</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET IP MULTICAST_TTL 10&gt;</span>
</pre>

                              <div class="method-source-code" id="ipv4_multicast_ttl-source">
            <pre>static VALUE
sockopt_s_ipv4_multicast_ttl(VALUE klass, VALUE value)
{
#if defined(IPPROTO_IP) &amp;&amp; defined(IP_MULTICAST_TTL)
    VALUE o = XCAT(sockopt_pack_,TYPE_IP_MULTICAST_TTL)(value);
    return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_TTL, o);
#else
# error IPPROTO_IP or IP_MULTICAST_TTL is not implemented
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-linger" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.linger(onoff, secs) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="Option.html"><code>Socket::Option</code></a> object for SOL_SOCKET/SO_LINGER.</p>

<p><em>onoff</em> should be an integer or a boolean.</p>

<p><em>secs</em> should be the number of seconds.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">linger</span>(<span class="ruby-keyword">true</span>, <span class="ruby-value">10</span>)
<span class="ruby-comment">#=&gt; #&lt;Socket::Option: UNSPEC SOCKET LINGER on 10sec&gt;</span>
</pre>

                              <div class="method-source-code" id="linger-source">
            <pre>static VALUE
sockopt_s_linger(VALUE klass, VALUE vonoff, VALUE vsecs)
{
    VALUE tmp;
    struct linger l;
    memset(&amp;l, 0, sizeof(l));
    if (!NIL_P(tmp = rb_check_to_integer(vonoff, &quot;to_int&quot;)))
        l.l_onoff = NUM2INT(tmp);
    else
        l.l_onoff = RTEST(vonoff) ? 1 : 0;
    l.l_linger = NUM2INT(vsecs);
    return rsock_sockopt_new(AF_UNSPEC, SOL_SOCKET, SO_LINGER, pack_var(l));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Socket::Option.new(family, level, optname, data) &rarr; sockopt
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a new <a href="Option.html"><code>Socket::Option</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i&quot;</span>))
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span> <span class="ruby-comment">#=&gt; #&lt;Socket::Option: INET SOCKET KEEPALIVE 1&gt;</span>
</pre>

                              <div class="method-source-code" id="new-source">
            <pre>static VALUE
sockopt_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE data)
{
    int family = rsock_family_arg(vfamily);
    int level = rsock_level_arg(family, vlevel);
    int optname = rsock_optname_arg(family, level, voptname);
    StringValue(data);
    rb_ivar_set(self, rb_intern(&quot;family&quot;), INT2NUM(family));
    rb_ivar_set(self, rb_intern(&quot;level&quot;), INT2NUM(level));
    rb_ivar_set(self, rb_intern(&quot;optname&quot;), INT2NUM(optname));
    rb_ivar_set(self, rb_intern(&quot;data&quot;), data);
    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-bool" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          bool &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the data in <em>sockopt</em> as an boolean value.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">int</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-value">1</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">bool</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>
</pre>

                              <div class="method-source-code" id="bool-source">
            <pre>static VALUE
sockopt_bool(VALUE self)
{
    int i;
    long len;
    VALUE data = sockopt_data(self);
    StringValue(data);
    len = RSTRING_LEN(data);
    if (len == 1) {
        return *RSTRING_PTR(data) == 0 ? Qfalse : Qtrue;
    }
    check_size(len, sizeof(int));
    memcpy((char*)&amp;i, RSTRING_PTR(data), len);
    return i == 0 ? Qfalse : Qtrue;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-byte" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          byte &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the data in <em>sockopt</em> as an byte.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">byte</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-value">1</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">byte</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">1</span>
</pre>

                              <div class="method-source-code" id="byte-source">
            <pre>static VALUE
sockopt_byte(VALUE self)
{
    VALUE data = sockopt_data(self);
    StringValue(data);
    check_size(RSTRING_LEN(data), sizeof(char));
    return CHR2FIX(*RSTRING_PTR(data));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-data" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          data &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the socket option data as a string.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET6</span>, <span class="ruby-value">:IPV6</span>, <span class="ruby-value">:RECVPKTINFO</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i!&quot;</span>)).<span class="ruby-identifier">data</span>
<span class="ruby-comment">#=&gt; &quot;\x01\x00\x00\x00&quot;</span>
</pre>

                              <div class="method-source-code" id="data-source">
            <pre>static VALUE
sockopt_data(VALUE self)
{
    VALUE v = rb_attr_get(self, rb_intern(&quot;data&quot;));
    StringValue(v);
    return v;
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Option.html#method-i-to_s">to_s</a>
                            </div>

                          </div>

                  <div id="method-i-family" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          family &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the socket family as an integer.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET6</span>, <span class="ruby-value">:IPV6</span>, <span class="ruby-value">:RECVPKTINFO</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i!&quot;</span>)).<span class="ruby-identifier">family</span>
<span class="ruby-comment">#=&gt; 10</span>
</pre>

                              <div class="method-source-code" id="family-source">
            <pre>static VALUE
sockopt_family_m(VALUE self)
{
    return rb_attr_get(self, rb_intern(&quot;family&quot;));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          inspect &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string which shows sockopt in human-readable form.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i&quot;</span>)).<span class="ruby-identifier">inspect</span>
<span class="ruby-comment">#=&gt; &quot;#&lt;Socket::Option: INET SOCKET KEEPALIVE 1&gt;&quot;</span>
</pre>

                              <div class="method-source-code" id="inspect-source">
            <pre>static VALUE
sockopt_inspect(VALUE self)
{
    int family = NUM2INT(sockopt_family_m(self));
    int level = NUM2INT(sockopt_level_m(self));
    int optname = NUM2INT(sockopt_optname_m(self));
    VALUE data = sockopt_data(self);
    VALUE v, ret;
    ID family_id, level_id, optname_id;
    int inspected;

    StringValue(data);

    ret = rb_sprintf(&quot;#&lt;%s:&quot;, rb_obj_classname(self));

    family_id = rsock_intern_family_noprefix(family);
    if (family_id)
        rb_str_catf(ret, &quot; %s&quot;, rb_id2name(family_id));
    else
        rb_str_catf(ret, &quot; family:%d&quot;, family);

    if (level == SOL_SOCKET) {
        rb_str_cat2(ret, &quot; SOCKET&quot;);

        optname_id = rsock_intern_so_optname(optname);
        if (optname_id)
            rb_str_catf(ret, &quot; %s&quot;, rb_id2name(optname_id));
        else
            rb_str_catf(ret, &quot; optname:%d&quot;, optname);
    }
#ifdef HAVE_TYPE_STRUCT_SOCKADDR_UN
    else if (family == AF_UNIX) {
        rb_str_catf(ret, &quot; level:%d&quot;, level);

        optname_id = rsock_intern_local_optname(optname);
        if (optname_id)
            rb_str_catf(ret, &quot; %s&quot;, rb_id2name(optname_id));
        else
            rb_str_catf(ret, &quot; optname:%d&quot;, optname);
    }
#endif
    else if (IS_IP_FAMILY(family)) {
        level_id = rsock_intern_iplevel(level);
        if (level_id)
            rb_str_catf(ret, &quot; %s&quot;, rb_id2name(level_id));
        else
            rb_str_catf(ret, &quot; level:%d&quot;, level);

        v = optname_to_sym(level, optname);
        if (SYMBOL_P(v))
            rb_str_catf(ret, &quot; %&quot;PRIsVALUE, rb_sym2str(v));
        else
            rb_str_catf(ret, &quot; optname:%d&quot;, optname);
    }
    else {
        rb_str_catf(ret, &quot; level:%d&quot;, level);
        rb_str_catf(ret, &quot; optname:%d&quot;, optname);
    }

    inspected = 0;

    if (level == SOL_SOCKET)
        family = AF_UNSPEC;
    switch (family) {
      case AF_UNSPEC:
        switch (level) {
          case SOL_SOCKET:
            switch (optname) {
#            if defined(SO_DEBUG) /* POSIX */
              case SO_DEBUG: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_ERROR) /* POSIX */
              case SO_ERROR: inspected = inspect_errno(level, optname, data, ret); break;
#            endif
#            if defined(SO_TYPE) /* POSIX */
              case SO_TYPE: inspected = inspect_socktype(level, optname, data, ret); break;
#            endif
#            if defined(SO_ACCEPTCONN) /* POSIX */
              case SO_ACCEPTCONN: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_BROADCAST) /* POSIX */
              case SO_BROADCAST: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_REUSEADDR) /* POSIX */
              case SO_REUSEADDR: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_KEEPALIVE) /* POSIX */
              case SO_KEEPALIVE: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_OOBINLINE) /* POSIX */
              case SO_OOBINLINE: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_SNDBUF) /* POSIX */
              case SO_SNDBUF: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_RCVBUF) /* POSIX */
              case SO_RCVBUF: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_DONTROUTE) /* POSIX */
              case SO_DONTROUTE: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_RCVLOWAT) /* POSIX */
              case SO_RCVLOWAT: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_SNDLOWAT) /* POSIX */
              case SO_SNDLOWAT: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(SO_LINGER) /* POSIX */
              case SO_LINGER: inspected = inspect_linger(level, optname, data, ret); break;
#            endif
#            if defined(SO_RCVTIMEO) /* POSIX */
              case SO_RCVTIMEO: inspected = inspect_timeval_as_interval(level, optname, data, ret); break;
#            endif
#            if defined(SO_SNDTIMEO) /* POSIX */
              case SO_SNDTIMEO: inspected = inspect_timeval_as_interval(level, optname, data, ret); break;
#            endif
#            if defined(SO_PEERCRED) /* GNU/Linux, OpenBSD */
              case SO_PEERCRED: inspected = inspect_peercred(level, optname, data, ret); break;
#            endif
            }
            break;
        }
        break;

      case AF_INET:
#ifdef INET6
      case AF_INET6:
#endif
        switch (level) {
#        if defined(IPPROTO_IP)
          case IPPROTO_IP:
            switch (optname) {
#            if defined(IP_MULTICAST_IF) &amp;&amp; defined(HAVE_TYPE_STRUCT_IP_MREQN) /* 4.4BSD, GNU/Linux */
              case IP_MULTICAST_IF: inspected = inspect_ipv4_multicast_if(level, optname, data, ret); break;
#            endif
#            if defined(IP_ADD_MEMBERSHIP) /* 4.4BSD, GNU/Linux */
              case IP_ADD_MEMBERSHIP: inspected = inspect_ipv4_add_drop_membership(level, optname, data, ret); break;
#            endif
#            if defined(IP_DROP_MEMBERSHIP) /* 4.4BSD, GNU/Linux */
              case IP_DROP_MEMBERSHIP: inspected = inspect_ipv4_add_drop_membership(level, optname, data, ret); break;
#            endif
#            if defined(IP_MULTICAST_LOOP) /* 4.4BSD, GNU/Linux */
              case IP_MULTICAST_LOOP: inspected = inspect_ipv4_multicast_loop(level, optname, data, ret); break;
#            endif
#            if defined(IP_MULTICAST_TTL) /* 4.4BSD, GNU/Linux */
              case IP_MULTICAST_TTL: inspected = inspect_ipv4_multicast_ttl(level, optname, data, ret); break;
#            endif
            }
            break;
#        endif

#        if defined(IPPROTO_IPV6)
          case IPPROTO_IPV6:
            switch (optname) {
#            if defined(IPV6_MULTICAST_HOPS) /* POSIX */
              case IPV6_MULTICAST_HOPS: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_MULTICAST_IF) /* POSIX */
              case IPV6_MULTICAST_IF: inspected = inspect_ipv6_multicast_if(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_MULTICAST_LOOP) /* POSIX */
              case IPV6_MULTICAST_LOOP: inspected = inspect_uint(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_JOIN_GROUP) /* POSIX */
              case IPV6_JOIN_GROUP: inspected = inspect_ipv6_mreq(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_LEAVE_GROUP) /* POSIX */
              case IPV6_LEAVE_GROUP: inspected = inspect_ipv6_mreq(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_UNICAST_HOPS) /* POSIX */
              case IPV6_UNICAST_HOPS: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(IPV6_V6ONLY) /* POSIX */
              case IPV6_V6ONLY: inspected = inspect_int(level, optname, data, ret); break;
#            endif
            }
            break;
#        endif

#        if defined(IPPROTO_TCP)
          case IPPROTO_TCP:
            switch (optname) {
#            if defined(TCP_NODELAY) /* POSIX */
              case TCP_NODELAY: inspected = inspect_int(level, optname, data, ret); break;
#            endif
#            if defined(TCP_INFO) &amp;&amp; defined(HAVE_TYPE_STRUCT_TCP_INFO) /* Linux, FreeBSD */
              case TCP_INFO: inspected = inspect_tcp_info(level, optname, data, ret); break;
#            endif
            }
            break;
#        endif
        }
        break;

#ifdef HAVE_TYPE_STRUCT_SOCKADDR_UN
      case AF_UNIX:
        switch (level) {
          case 0:
            switch (optname) {
#            if defined(LOCAL_PEERCRED)
              case LOCAL_PEERCRED: inspected = inspect_local_peercred(level, optname, data, ret); break;
#            endif
            }
            break;
        }
        break;
#endif
    }

    if (!inspected) {
        rb_str_cat2(ret, &quot; &quot;);
        rb_str_append(ret, rb_str_dump(data));
    }

    rb_str_cat2(ret, &quot;&gt;&quot;);

    return ret;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-int" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          int &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the data in <em>sockopt</em> as an int.</p>

<p>The size and endian is dependent on the platform.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">int</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, <span class="ruby-value">1</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">int</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">1</span>
</pre>

                              <div class="method-source-code" id="int-source">
            <pre>static VALUE
sockopt_int(VALUE self)
{
    int i;
    VALUE data = sockopt_data(self);
    StringValue(data);
    check_size(RSTRING_LEN(data), sizeof(int));
    memcpy((char*)&amp;i, RSTRING_PTR(data), sizeof(int));
    return INT2NUM(i);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ipv4_multicast_loop" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ipv4_multicast_loop &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the <a href="Option.html#method-c-ipv4_multicast_loop"><code>ipv4_multicast_loop</code></a> data in <em>sockopt</em> as an integer.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">ipv4_multicast_loop</span>(<span class="ruby-value">10</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">ipv4_multicast_loop</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">10</span>
</pre>

                              <div class="method-source-code" id="ipv4_multicast_loop-source">
            <pre>static VALUE
sockopt_ipv4_multicast_loop(VALUE self)
{
    int family = NUM2INT(sockopt_family_m(self));
    int level = sockopt_level(self);
    int optname = sockopt_optname(self);

#if defined(IPPROTO_IP) &amp;&amp; defined(IP_MULTICAST_LOOP)
    if (family == AF_INET &amp;&amp; level == IPPROTO_IP &amp;&amp; optname == IP_MULTICAST_LOOP) {
        return XCAT(sockopt_,TYPE_IP_MULTICAST_LOOP)(self);
    }
#endif
    rb_raise(rb_eTypeError, &quot;ipv4_multicast_loop socket option expected&quot;);
    UNREACHABLE_RETURN(Qnil);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ipv4_multicast_ttl" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ipv4_multicast_ttl &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the <a href="Option.html#method-c-ipv4_multicast_ttl"><code>ipv4_multicast_ttl</code></a> data in <em>sockopt</em> as an integer.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">ipv4_multicast_ttl</span>(<span class="ruby-value">10</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">ipv4_multicast_ttl</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">10</span>
</pre>

                              <div class="method-source-code" id="ipv4_multicast_ttl-source">
            <pre>static VALUE
sockopt_ipv4_multicast_ttl(VALUE self)
{
    int family = NUM2INT(sockopt_family_m(self));
    int level = sockopt_level(self);
    int optname = sockopt_optname(self);

#if defined(IPPROTO_IP) &amp;&amp; defined(IP_MULTICAST_TTL)
    if (family == AF_INET &amp;&amp; level == IPPROTO_IP &amp;&amp; optname == IP_MULTICAST_TTL) {
        return XCAT(sockopt_,TYPE_IP_MULTICAST_TTL)(self);
    }
#endif
    rb_raise(rb_eTypeError, &quot;ipv4_multicast_ttl socket option expected&quot;);
    UNREACHABLE_RETURN(Qnil);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-level" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          level &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the socket level as an integer.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET6</span>, <span class="ruby-value">:IPV6</span>, <span class="ruby-value">:RECVPKTINFO</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i!&quot;</span>)).<span class="ruby-identifier">level</span>
<span class="ruby-comment">#=&gt; 41</span>
</pre>

                              <div class="method-source-code" id="level-source">
            <pre>static VALUE
sockopt_level_m(VALUE self)
{
    return INT2NUM(sockopt_level(self));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-linger" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          linger &rarr; [bool, seconds]
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the linger data in <em>sockopt</em> as a pair of boolean and integer.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">linger</span>(<span class="ruby-keyword">true</span>, <span class="ruby-value">10</span>)
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">linger</span> <span class="ruby-operator">=&gt;</span> [<span class="ruby-keyword">true</span>, <span class="ruby-value">10</span>]
</pre>

                              <div class="method-source-code" id="linger-source">
            <pre>static VALUE
sockopt_linger(VALUE self)
{
    int level = sockopt_level(self);
    int optname = sockopt_optname(self);
    VALUE data = sockopt_data(self);
    struct linger l;
    VALUE vonoff, vsecs;

    if (level != SOL_SOCKET || optname != SO_LINGER)
        rb_raise(rb_eTypeError, &quot;linger socket option expected&quot;);
    check_size(RSTRING_LEN(data), sizeof(struct linger));
    memcpy((char*)&amp;l, RSTRING_PTR(data), sizeof(struct linger));
    switch (l.l_onoff) {
      case 0: vonoff = Qfalse; break;
      case 1: vonoff = Qtrue; break;
      default: vonoff = INT2NUM(l.l_onoff); break;
    }
    vsecs = INT2NUM(l.l_linger);
    return rb_assoc_new(vonoff, vsecs);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-optname" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          optname &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>returns the socket option name as an integer.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET6</span>, <span class="ruby-value">:IPV6</span>, <span class="ruby-value">:RECVPKTINFO</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i!&quot;</span>)).<span class="ruby-identifier">optname</span>
<span class="ruby-comment">#=&gt; 2</span>
</pre>

                              <div class="method-source-code" id="optname-source">
            <pre>static VALUE
sockopt_optname_m(VALUE self)
{
    return INT2NUM(sockopt_optname(self));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_s &rarr; string
                              </span>
                            </div>

                            <div class="method-description">
                              <p>returns the socket option data as a string.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET6</span>, <span class="ruby-value">:IPV6</span>, <span class="ruby-value">:RECVPKTINFO</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i!&quot;</span>)).<span class="ruby-identifier">data</span>
<span class="ruby-comment">#=&gt; &quot;\x01\x00\x00\x00&quot;</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Option.html#method-i-data">data</a>
                            </div>
                          </div>

                  <div id="method-i-unpack" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          unpack(template) &rarr; array
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Calls String#unpack on sockopt.data.</p>

<pre class="ruby"><span class="ruby-identifier">sockopt</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-constant">Option</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:SOCKET</span>, <span class="ruby-value">:KEEPALIVE</span>, [<span class="ruby-value">1</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;i&quot;</span>))
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-string">&quot;i&quot;</span>)      <span class="ruby-comment">#=&gt; [1]</span>
<span class="ruby-identifier">p</span> <span class="ruby-identifier">sockopt</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-string">&quot;i&quot;</span>) <span class="ruby-comment">#=&gt; [1]</span>
</pre>

                              <div class="method-source-code" id="unpack-source">
            <pre>static VALUE
sockopt_unpack(VALUE self, VALUE template)
{
    return rb_funcall(sockopt_data(self), rb_intern(&quot;unpack&quot;), 1, template);
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

